package chapter1;

/**
 * @author ycj
 * @version 1.0
 * @description: TODO
 * @date 2022/5/16
 */
public class Source1_7 {
    public static void main(String[] args) {
        //获取当前线程
        Thread thread = Thread.currentThread();

        //获取当前线程名
        String name = thread.getName();

        System.out.println("执行main方法的线程是:"+name);

        Helper help = new Helper("help");
        help.run();
    }
}

class Helper implements Runnable{
    private String message;

    public Helper(String message) {
        System.out.println("执行Helper的构造器方法的线程是:"+Thread.currentThread().getName());
        this.message = message;
    }


    private void show(){
        System.out.println("执行show方法的线程是:"+Thread.currentThread().getName());
    }

    @Override
    public void run() {
        this.show();
    }
}
